#pragma once

#include "vortex/application2d.h"

#include "vortex/graphics/renderer/sprite_renderer.h"
#include "vortex/graphics/renderer/bfont_renderer.h"
#include "vortex/graphics/renderer/mesh_renderer1.h"
#include "vortex/graphics/renderer/mesh_renderer.h"
#include "vortex/graphics/renderer/cubemap_renderer.h"
#include "vortex/graphics/renderable/animation2d.h"

#include "vortex/ui/uilayer.h"
#include "vortex/graphics/projection.h"
#include "vortex/core/window.h"
#include "vortex/core/asset.h"
#include "vortex/core/rng.h"
#include "vortex/core/timer.h"


void create_sprites(std::vector<vortex::ColoredQuad>& sprites, uint32_t num_quads);


class Sample2d : public vortex::Application2d
{
private:
    std::shared_ptr<vortex::SpriteRenderer> renderer;
    std::shared_ptr<vortex::BFontRenderer> font_renderer;
    std::shared_ptr<vortex::UILayer> ui_renderer;

    vortex::Environment2D env2d;
    vortex::Timer timer;
    float frame_time = 0.0f;

    // sprites
    vortex::ColoredQuad sprite1;
    vortex::ColoredQuad sprite2;

    vortex::SpriteQuad sprite3;
    vortex::AnimatedSprite sprite4;
    // vortex::SpriteQuad sprite4;
    // std::vector<vortex::ColoredQuad> sprites;

    float camera2d_offset_x = 0.0f;
    float camera2d_offset_y = 0.0f;

public:
    Sample2d(const vortex::AppInfo2d& info);
    ~Sample2d() {}

    void Update();
    void RenderScene();
    void RenderUI();

    void Render()
    {
        RenderScene();
        RenderUI();
    }
};
